import VueRouter from 'vue-router'

import Home from 'components/Home'
import routerAccount from 'components/account/router-account'
import routerLogin from 'components/login/router-login'
import routerSearch from 'components/search/router-search'
import routerBook from 'components/book/router-book'
import routerBorrow from 'components/borrow/router-borrow'
import MapView from './pages/Map'
import Webview from './pages/webview'
import Jiangou from './pages/Jiangou'
import News from './pages/News'
import NewsList from './pages/NewsList'

const router = {
  // 非根路径或者不兼容的浏览器时必须使用hash，
  // 正式上线版本应该改成 history
  // mode: 'hash',
  routes: [
    {
      path: '/',
      name: 'index',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: Home
    },
    {
      path: '/tool',
      name: 'tool',
      component: Home
    },
    {
      path: '/center',
      name: 'center',
      component: Home
    },
    routerAccount,
    routerLogin,
    routerSearch,
    ...routerBook,
    ...routerBorrow,

    {
      path: '/map',
      name: 'map',
      component: MapView,
      meta: {
        title: '周边图书馆'
      }
    },
    {
      path: '/jiangou',
      name: 'jiangou',
      component: Jiangou
    },
    {
      path: '/news',
      name: 'news',
      component: NewsList
    },
    {
      path: '/news/:id',
      component: News
    },
    {
      path: '/webview',
      name: 'webview',
      component: Webview
    }
  ]
}

export default new VueRouter(router)
